package thread;

import org.junit.Test;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class HashMapTest {
	public static void main(String[] args) {
		final HashMap<String, String> map = new HashMap<String, String>(2);
		Thread t = new Thread(new Runnable() {
			@Override
			public void run() {
				for(int i = 0; i<1000; i++){
					new Thread(new Runnable() {
						@Override
						public void run() {
							map.put(UUID.randomUUID().toString(), "");
						}
					}, "ftf"+i).start();
				}
			}
		}, "ftf");
		t.start();
		try {
			t.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	@Test
	public void test01(){
		Map<String,String> map = new HashMap<>();
		map.put("aaa","111");
		System.out.println(map.remove("bbb"));
		System.out.println(map.remove("aaa"));
		System.out.println(map.remove("aaa")==null);
	}
}
